    package com.yyj.Test;

    import com.yyj.pojo.MessageData;
    import com.yyj.repository.MsgdatanewRepository;
    import org.apache.ibatis.session.SqlSession;
    import org.apache.ibatis.session.SqlSessionFactory;
    import org.apache.ibatis.session.SqlSessionFactoryBuilder;

    import java.io.InputStream;

    public class Test2 {
    //    public void add(String toName,String message,String fromName){
    public static void main(String[] args) {
        InputStream inputStream = Test2.class.getClassLoader().getResourceAsStream("config.xml");
        SqlSessionFactoryBuilder sqlSessionFactoryBuilder = new SqlSessionFactoryBuilder();
        SqlSessionFactory sqlSessionFactory = sqlSessionFactoryBuilder.build(inputStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        MsgdatanewRepository msgdatanewRepository = sqlSession.getMapper(MsgdatanewRepository.class);
        MessageData messageData=new MessageData();
    //    messageData.setToName(toName);
    //    messageData.setMessage(message);
    //    messageData.setFromName(fromName);
        messageData.setToName("zhangsan");
        messageData.setMessage("nihaoyayay");
        messageData.setFromName("lisi");
        int save = msgdatanewRepository.save1(messageData);
        System.out.println(save);
        sqlSession.commit();
    }
    }
